<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Load php files
 *
 * @author QuangKhoi
 */
class Loader {

    //put your code here
    public function load() {
        include("Configuration.php");
        include("Database.php");
        include("DataTable.php");
        include("QueryResult.php");
        include("UserLoader.php");
        include("View/{$GLOBALS['deviceType']}/Master/MasterView.php");
        include("Libs/nusoap/nusoap.php");
        include("Libs/recaptcha/recaptchalib.php");
        include("Model/SOAP/bpServer.php");
        include("Model/Bret.php");
        include("Model/Image.php");
        include("Model/recaptcha.php");
        include("ErrorLoader.php");
        ErrorLoader::load();
        UserLoader::load();

        //Param parser
        #remove the directory path we don't want 
        $url = $_SERVER['REQUEST_URI'];
        $url = ltrim($url, '/');
        $request = $url;
        $host = "/bret";
        $absoluteUrl = 'http://' . $_SERVER['HTTP_HOST'] . $host;
        $request = substr($request, strlen($host));
        if (strpos($request, '?') != '') {
            $request = substr($request, 0, strpos($request, "?"));
        }
        #split the path by '/'
        $params = explode("/", $request);
        switch (strtoupper($params[0])) {
            case "MANAGER":
                require_once 'ManagerLoader.php';
                ManagerLoader::load();
                break;
        }
    }

}
